import React,{useState,useRef} from 'react'

export default function App() {
    const [count,setcount]=useState(0)
     // useRef保存引用值,使用useRef会缓存值
     let mycount=useRef(0)

  return (
    <div>
        {count}--{mycount.current}
        <button onClick={()=>{
            setcount(count+1)
            mycount.current++
        }}>
            clcik
        </button>
    </div>
  )
}
